/*************************************************
Author: will
Date: 9/11/2012
Description:
Notes: 
*************************************************/

#ifndef __CTaskCond_h__
#define __CTaskCond_h__

#include "CTaskDef.h"

class CTaskTargetStat;
class CTaskCond
{
    friend class CTaskTargetStat;
public:
    enum TASK_COND  //任务激活条件
    {
        TASK_NONE = 0,         //无
        TASK_LEVEL_UP,         //等级
        TASK_PET_LEVEL_UP,     //宠物等级
        TASK_TASK_FINISH,      //完成某个任务
        TASK_BOSS_CONQUER,     //击败BOSS
        TASK_ENEMY_KILL,       //消灭怪物
        TASK_DO_SOME_OPT,      //进行某些操作
        TASK_USE_ITEM,         //使用道具
        TASK_GET_ITEM,         //获得道具
        TASK_GET_AND_COMMIT_ITEM, //获得并提交道具
        TASK_FINISH_STAGE,     //通关
        TASK_HOLD_CONDITION,   //保持状态
        
        TASK_NCP_TALK = 13,    //和NPC对话，前台用
    };

    CTaskCond() 
        :_ucCond(TASK_NONE), _iCondData1(0), _iCondData2(0)
    {
    }

    virtual ~CTaskCond() 
    {
    }

    int Init(CTaskCondData& stData)
    {
        _ucCond = stData._ucCond;
        _iCondData1 = stData._iCondData1;
        _iCondData2 = stData._iCondData2;

        return 0;
    }

    int GetData(CTaskCondData& stData)
    {
        stData._ucCond = _ucCond;
        stData._iCondData1 = _iCondData1;
        stData._iCondData2 = _iCondData2;

        return 0;
    }

    static bool IsReachCond(CTaskCond& stCond, CTaskCond& stStat);

public:
    unsigned char _ucCond;          //激活类型
    int _iCondData1;                //激活条件数值1，辅助_ucOpenCond
    int _iCondData2;                //激活条件数值2，辅助_ucOpenCond
};


#endif // __CTaskCond_h__

